import Taro, { Component } from '@tarojs/taro'
import { Provider } from '@tarojs/redux'

import Home from './pages/home/home'

import configStore from './store'

import './styles/theme.scss'
import './app.scss'


// 如果需要在 h5 环境中开启 React Devtools
// 取消以下注释：
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5')  {
//   require('nerv-devtools')
// }

const store = configStore()

class App extends Component {

  config = {
    pages: [
      'pages/home/home',
      'pages/cate/cate',
      'pages/cateSub/cateSub',
      'pages/cart/cart',
      'pages/user/user',
      'pages/userLogin/userLogin',
      'pages/item/item',
      'pages/search/search',
      'pages/address/address',
      'pages/addressAdd/addressAdd',
      'pages/orderList/orderList',
      'pages/orderSettlement/orderSettlement',
      'pages/orderInfo/orderInfo',
      'pages/payResult/payResult',
      'pages/coupon/coupon',
      'pages/afterSale/afterSale',
      'pages/afterSaleList/afterSaleList',
      'pages/webview/webview'
    ],
    window: {
      backgroundTextStyle: 'light',
      navigationBarBackgroundColor: '#fff',
      navigationBarTitleText: 'WeChat',
      navigationBarTextStyle: 'black',
      // navigationStyle: 'custom'
    },
    tabBar: {
      color: "#666",
      selectedColor: "#b4282d",
      backgroundColor: "#fafafa",
      borderStyle: 'black',
      list: [{
        pagePath: "pages/home/home",
        iconPath: "./assets/home.png",
        selectedIconPath: "./assets/home-active.png",
        text: "首页"
      }, {
        pagePath: "pages/cate/cate",
        iconPath: "./assets/cate.png",
        selectedIconPath: "./assets/cate-active.png",
        text: "分类"
      }, {
        pagePath: "pages/cart/cart",
        iconPath: "./assets/cart.png",
        selectedIconPath: "./assets/cart-active.png",
        text: "购物车"
      }, {
        pagePath: "pages/user/user",
        iconPath: "./assets/user.png",
        selectedIconPath: "./assets/user-active.png",
        text: "个人"
      }]
    }
  }

  componentDidMount () {}

  componentDidShow () {}

  componentDidHide () {}

  componentDidCatchError () {}

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render () {
    return (
      <Provider store={store}>
        <Home />
      </Provider>
    )
  }
}

Taro.render(<App />, document.getElementById('app'))
